package com.future.cb.web.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.future.cb.web.interceptor.AuthenInterceptor;
import com.future.cb.web.interceptor.LogInterceptor;

@Configuration
public class MvcConfig implements WebMvcConfigurer{
	
    @Bean
    public AuthenInterceptor AuthenInterceptor() {
    	return new AuthenInterceptor();
    }
    
    @Bean
    public LogInterceptor LogInterceptor() {
    	return new LogInterceptor();
    }
    
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		//认证拦截器
		registry.addInterceptor(AuthenInterceptor()).addPathPatterns("/**");
		registry.addInterceptor(LogInterceptor()).addPathPatterns("/**");
	}
	
}
